package com.gxuwz.medical.tools;

import org.junit.Test;

public class PasswordTest {

	/**
	 * 
	 * @Title: MD5Test @Description: 密码加密工具类测试 @author 陈震洺 @throws Exception @throws
	 */

	@Test
	public void MD5Test() throws Exception {
		String encode = PasswordUtil.MD5Encode("admin", "UTF8", true);
		System.out.println();
		System.out.println("MD5�㷨:" + encode);
	}

	@Test
	public void aesTest() throws Exception {
		String content = "123456";
		String aesKey = "thisiskey";

		byte[] encrypt = PasswordUtil.AESEncrypt(content, aesKey);// ����
		System.out.println("AES���ܺ�-byte[]:" + encrypt);

		String strHex = PasswordUtil.parseByte2HexStr(encrypt);
		System.out.println("ת�����ʮ������:" + strHex);

		byte[] decrypt = PasswordUtil.AESDecrypt(PasswordUtil.parseHexStr2Byte(strHex), aesKey);// ����

		System.out.println("AES���ܺ�-byte[]" + decrypt);
		System.out.println("AES����ת����:" + new String(decrypt));
	}

}